/**
 * 获取当前环境
 * @returns 
 */
export const getEnv = ():string => {
  return import.meta.env.MODE
}

/** 开发环境 */
export const devMode = 'development'

/** 生产环境 */
export const prodMode = 'production'

/**
 * 获取并处理环境变量
 * @returns 
 */
export const getAppEnvConfig = ():ImportMetaEnv => {
  const envObj = import.meta.env
  let env:ImportMetaEnv = envObj
  for (const key in envObj) {
    if (envObj[key] === 'true') {
      env[key] = true
    } else if (envObj[key] === 'false') {
      env[key] = false
    } else if (!isNaN(envObj[key])) {
      env[key] = +envObj[key]
    } else {
      env[key] = envObj[key]
    }
  }

  return env as ImportMetaEnv
}